﻿
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>UTC</title>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
  <div class="layui-header">
    <div class="layui-logo">UTC</div>
    <!-- 头部区域（可配合layui已有的水平导航） -->
    <ul class="layui-nav layui-layout-left">
      <li class="layui-nav-item"><a href="">控制台</a></li>
      <li class="layui-nav-item"><a href="">商品管理</a></li>
      <li class="layui-nav-item"><a href="">用户</a></li>
      <li class="layui-nav-item">
        <a href="javascript:;">其它系统</a>
        <dl class="layui-nav-child">
          <dd><a href="">邮件管理</a></dd>
          <dd><a href="">消息管理</a></dd>
          <dd><a href="">授权管理</a></dd>
        </dl>
      </li>
    </ul>
    <ul class="layui-nav layui-layout-right">
      <li class="layui-nav-item">
        <a href="javascript:;">
          <img src="" class="layui-nav-img">
          贤心
        </a>
        <dl class="layui-nav-child">
          <dd><a href="">基本资料</a></dd>
          <dd><a href="">安全设置</a></dd>
        </dl>
      </li>
      <li class="layui-nav-item"><a href="">退了</a></li>
    </ul>
  </div>
  
  <div class="layui-side layui-bg-black">
    <div class="layui-side-scroll">
      <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
      <ul id="menu" class="layui-nav layui-nav-tree"></ul>
    </div>
  </div>
  
  <div id="main" class="layui-body">
    <!-- 内容主体区域 -->
    <div style="padding: 15px;">内容主体区域</div>
  </div>
  
  <div class="layui-footer">
    <!-- 底部固定区域 -->
    © UTC.com - 底部固定区域
  </div>
</div>

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="_header.jsp"%>
<script>

function menuLayui(data,dom){
	var s = "<li class=\"layui-nav-item\"></li>";
	for(i=0;i<data.length;i++){
		if(data[i].pid==0){
			li = $("<li class=\"layui-nav-item\"></li>");
			li.append($("<a href=\"javascript:;\">" + data[i].name + "</a>"));
			dl = $("<dl class=\"layui-nav-child\"></dl>");
			li.append(dl);
			for(j=0;j<data.length;j++){
				if(data[i].id==data[j].pid){
					dd = $("<dd></dd>");
					dd.append($("<a href=\"javascript:so(\'"+data[j].url+"\')\">" + data[j].name + "</a>"));
					dl.append(dd);
					}
			}
			dom.append(li);
		}
	}
}


layui.use('element', function(){
  var element = layui.element;
  $.ajax({
		type : "POST",
		url : "menu/list",
		success : function(data) {
			menuLayui(data,$('#menu'));
			element.render('Nav');
		},
	});
});
</script>
</body>
</html>